using System;

namespace Actions.Security
{
	/// <summary>
	/// Description of Usecase.
	/// </summary>
	public class Usecase
	{
		private string		_name;
		private string		_title;
		
		public string		name
		{
			get
			{
				return _name;
			}
		}		
		public string		title
		{
			get
			{
				return _title;
			}
		}
		
		public Usecase(string n)
		{
			_name = "UC" + n;
			_title = "";			
		}
		
		public Usecase(string n, string t)
		{
			_name = "UC" + n;
			_title = t;			
		}
				
		public static bool operator == (Usecase u1, Usecase u2)
		{
			return u1.Equals(u2);
		}
		
		public static bool operator != (Usecase u1, Usecase u2)
		{
			return !u1.Equals(u2);
		}
		
		public override int GetHashCode()
		{
			return _name.GetHashCode();
		}
		
		public override bool Equals(object o)
		{
			if((o as Usecase)._name == _name) return true;
			else return false;
		}
		
		protected bool Equals(Usecase u)
		{
			if(u.name == _name) {
				if(u.title.Length > 1) {
					_title = u.title;	
				}
				return true;
			} else return false;
		}			
	}
}
